#pragma once

#include "Event.h"
#include "MapLayerEnvelope.h"


class CMapLayer;
class CMapLayerMgr;

enum MapLayerActionType
{
    Undefined=0,
    Add,
    Delete
};

class MapLayerAction
{
public:
    MapLayerAction(){};
    MapLayerActionType actionType;
    CArray<CMapLayer*,CMapLayer*> m_mapLayers;
};

class CMapLayerActionHandler: public IEventHandler<CMapLayerMgr*, MapLayerAction*>
{
//public:
    /*typedef void(Observer::*MapActionFunc)(CMapLayerMgr* sender,MapLayerAction* para);
    MapActionFunc mapActionFunc;*/
};

class CMapLayerMgr
{
friend class CCanvas;
public:
    CMapLayerMgr();
    ~CMapLayerMgr();
    void addMapLayer(CMapLayer* pMapLayer);
    void deleteMapLayer(CMapLayer* pMapLayer);
	CMapLayerEnvelope getMaxEnvelope(){return m_maxEnvelope;}
	int getMayLayerCount(){return m_mapLayers.GetCount();}
    EventPublisher<CMapLayerMgr*, MapLayerAction*>* getEventPublisher(){return &m_eventPublisher;}
private:
    CArray<CMapLayer*> m_mapLayers;
	CMapLayerEnvelope m_maxEnvelope;
    EventPublisher<CMapLayerMgr*, MapLayerAction*> m_eventPublisher;
};
